﻿
@{
    Layout = "Views._layout.cshtml";
}
<div class="card">
    <div class="card-header border border-top-0 border-right-0 border-left-0">
        日志
    </div>
    <div class="card-body">
        <form>
            <div class="row">
                <div class="col-md-3">
                    <div class="form-group">
                        <div class="custom-control custom-checkbox">
                            <input type="checkbox" class="custom-control-input" id="all">
                            <label class="custom-control-label" for="all">所有</label>
                        </div>
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="form-group">
                        <div class="custom-control custom-checkbox">
                            <input type="checkbox" class="custom-control-input" id="unique">
                            <label class="custom-control-label" for="unique">不重复</label>
                        </div>
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="form-group">
                        <div class="custom-control custom-checkbox">
                            <input type="checkbox" class="custom-control-input" id="today">
                            <label class="custom-control-label" for="today">今天</label>
                        </div>
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="form-group">
                        <div class="custom-control custom-checkbox">
                            <input type="checkbox" class="custom-control-input" id="hour">
                            <label class="custom-control-label" for="hour">一小时</label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="Message" class="form-control-label">Message</label>
                        <input id="Message" class="form-control" placeholder="Message">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="Level" class="form-control-label">日志级别</label>
                        <select id="Level" class="form-control">
                            <option value="">All</option>
                            <option value="TRACE">Trace</option>
                            <option value="DEBUG">Debug</option>
                            <option value="INFO">Info</option>
                            <option value="WARN">Warn</option>
                            <option value="ERROR">Error</option>
                            <option value="FETAL">Fatal</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="StartTime" class="form-control-label">开始时间</label>
                        <input type="text" class="form-control datetimepicker-input" id="StartTime" data-toggle="datetimepicker" data-target="#StartTime" />
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="EndTime" class="form-control-label">结束时间</label>
                        <input type="text" class="form-control datetimepicker-input" id="EndTime" data-toggle="datetimepicker" data-target="#EndTime" />
                    </div>
                </div>
            </div>
            <button class="btn btn-outline-primary" id="searchBtn">查询</button>
        </form>

    </div>
    <div id="LogList">
        @Raw(ViewBag.logs)
    </div>
    <div id="page">
        @Raw(ViewBag.page)
    </div>
</div>

@section Scripts{
    <script>
        $(function () {
            $('#StartTime').datetimepicker({
                locale: 'zh-cn',
                Default: 'yyyy-mm-dd hh:mm:ss'
            });
            $('#EndTime').datetimepicker({
                locale: 'zh-cn',
                Default: 'yyyy-mm-dd hh:mm:ss'
            });
            setCheckbox("All", "all");
            setCheckbox("Today", "today");
            setCheckbox("Unique", "unique");
            setCheckbox("Hour", "hour");
        });

        function setCheckbox(str, id) {
            var val = getQueryString(str);
            if (val) {
                $("#" + id).prop("checked", true);
                searchInput[str] = val;
            }
        }
    </script>
}